﻿<?php
require_once("../../class2.php");
require_once(HEADERF);
require_once("./includes/require_all.php");
$database->cyr_chars();
ramka("open");
?>
<link rel="stylesheet" type="text/css" href="./css/main.css" /> 
<script type="text/javascript" src="./js/wz_tooltip.js"></script>
<?php
$page_class = "PlayON";
$userid = USERID;
$username = USERNAME;

echo "<a href='./../' class='forumheader4' style='font-size:14px; margin-left:10px;'>НАЗАД</a>";

if((USER and check_class($page_class)) or $username == "e-VIL" or $username == "Zlo" or $username == "mitaka18"){
	echo "<center class='forumheader4' style='margin-top:-20px; margin-left:-1px; padding-bottom:10px;'><h1 style='border-bottom:0px;'>Здравей, $username</h1></center>";
	
	$q = "SELECT * FROM admin_panel";
	$r = $database->query($q);
	$array_0 = array();
	$array_1 = array();
	$array_2 = array();
	while($a = $database->fetch_array($r)){
		$level_access = $a['level_access'];
		$id = $a['id'];
		if($level_access == 0){
			$array_0[] = $id;
		}
		elseif($level_access == 1){
			$array_1[] = $id;
		}
		else{
			$array_2[] = $id;
		}
	}
	
	echo "<table width=100% cellspacing='10' style='font-size: 14px; text-align: center;'><tr><td colspan='4' class='forumheader' style='font-size: 16px; color: orange;'>Игри видими от всички: </td></tr><tr>";
	$counter = 1;
	foreach($array_0 as $v){
		$q = "SELECT * FROM admin_panel WHERE id = $v";
		$r = $database->query($q);
		$a = $database->fetch_array($r);
		echo '<td class="forumheader3"><a href="admin_edit.php?id='.$a['id'].'" onmouseover="Tip(\''.addslashes(preg_replace("/[\r\n]/", "<br>", $a['game_desc'])).'\', BORDERCOLOR, \'#006699\', BGCOLOR, \'#FFFF66\', FONTFACE, \'Helvetica, Arial, sans-serif\', FONTSIZE, \'14px\', FONTCOLOR, \'#006699\',FONTWEIGHT, \'BOLD\', PADDING, \'10\')" onmouseout="UnTip()"><img src="'.$a['game_cover'].'" height="100" width="75"></a><br>'.$a['game_name'].' ['.$a['game_platform'].']<br>'.$a['rows_translated'].'/'.$a['rows_all'].' ('.$a['game_percent'].'%)</td>';
		if($counter % 4 == 0){
			echo "</tr><tr>";
		}
		$counter++;
	}
	$counter--;
	if($counter % 4 != 0) {
		while ($counter%4 != 0) {
			echo "<td class='forumheader3'></td>";
			$counter++;
		}
	}
	
	echo "</tr><tr><td colspan='4' class='forumheader' style='font-size: 16px; color: orange;'>Игри видими от регистрирани потребители и членове на екипа: </td></tr><tr>";
	$counter = 1;
	foreach($array_1 as $v){
		$q = "SELECT * FROM admin_panel WHERE id = $v";
		$r = $database->query($q);
		$a = $database->fetch_array($r);
		echo '<td class="forumheader" style="font-size: 16px; color: orange;"><a href="admin_edit.php?id='.$a['id'].'" onmouseover="Tip(\''.addslashes(preg_replace("/[\r\n]/", "<br>", $a['game_desc'])).'\', BORDERCOLOR, \'#006699\', BGCOLOR, \'#FFFF66\', FONTFACE, \'Helvetica, Arial, sans-serif\', FONTSIZE, \'14px\', FONTCOLOR, \'#006699\',FONTWEIGHT, \'BOLD\', PADDING, \'10\')" onmouseout="UnTip()"><img src="'.$a['game_cover'].'" height="100" width="75"></a><br>'.$a['game_name'].' ['.$a['game_platform'].']<br>'.$a['rows_translated'].'/'.$a['rows_all'].' ('.$a['game_percent'].'%)</td>';
		if($counter % 4 == 0){
			echo "</tr><tr>";
		}
		$counter++;
	}
	$counter--;
	if($counter % 4 != 0) {
		while ($counter%4 != 0) {
			echo "<td class='forumheader3'></td>";
			$counter++;
		}
	}
	
	echo "</tr><tr><td colspan='4' class='forumheader' style='font-size: 16px; color: orange;'>Игри видими само за членове на екипа: </td></tr><tr>";
	$counter = 1;
	foreach($array_2 as $v){
		$q = "SELECT * FROM admin_panel WHERE id = $v";
		$r = $database->query($q);
		$a = $database->fetch_array($r);
		echo '<td class="forumheader3"><a href="admin_edit.php?id='.$a['id'].'" onmouseover="Tip(\''.addslashes(preg_replace("/[\r\n]/", "<br>", $a['game_desc'])).'\', BORDERCOLOR, \'#006699\', BGCOLOR, \'#FFFF66\', FONTFACE, \'Helvetica, Arial, sans-serif\', FONTSIZE, \'14px\', FONTCOLOR, \'#006699\',FONTWEIGHT, \'BOLD\', PADDING, \'10\')" onmouseout="UnTip()"><img src="'.$a['game_cover'].'" height="100" width="75"></a><br>'.$a['game_name'].' ['.$a['game_platform'].']<br>'.$a['rows_translated'].'/'.$a['rows_all'].' ('.$a['game_percent'].'%)</td>';
		if($counter % 4 == 0){
			echo "</tr><tr>";
		}
		$counter++;
	}
	$counter--;
	if($counter % 4 != 0) {
		while ($counter%4 != 0) {
			echo "<td class='forumheader3'></td>";
			$counter++;
		}
	}
	
	echo "</tr></table>";
	
	echo "<div class='forumheader3'></div><div class='forumheader'>";
	
	echo "<center><a href='admin_panel.php' class='forumheader4' style='font-size:14px; margin-left:10px;'>ДОБАВИ ИГРА</a></center>";
	
	echo "</div><div class='forumheader3' style='margin-top:-2px;'></div>";
}
else{
	echo "<center style='font-size: 18px; color: red;'>Това е страница само за членове на екипа и сайта!!!</center>";
}

ramka("close");
require_once(FOOTERF);
?>